package com.ruoyi.pingjiao.mapper;

import com.ruoyi.pingjiao.domain.CoureassessAverage;
import org.apache.ibatis.annotations.*;

@Mapper
public interface CoureassessAverageMapper {
    @Insert("insert into coureassess_average (coureassess_id, coureassess_name_id, eva_average) VALUES " +
            "(#{coureassessId},#{coureassessNameId},#{evaAverage})")
    void save(CoureassessAverage coureassessAverage);

    @Select("select id from coureassess_average where coureassess_id = #{coureassessId} and coureassess_name_id = #{coureassessNameId}")
    Long selectByCoureassessIdAndCoureassessNameId(@Param("coureassessId") Long coureassessId,@Param("coureassessNameId") Long coureassessNameId);

    @Select("select id,coureassess_id,coureassess_name_id,eva_average from coureassess_average where coureassess_id = #{coureassessId} and coureassess_name_id = #{coureassessNameId}")
    @Results({
            @Result(property = "coureassessId", column = "coureassess_id"),
            @Result(property = "coureassessNameId", column = "coureassess_name_id"),
            @Result(property = "evaAverage", column = "eva_average")
    })
    CoureassessAverage selectByCoureassessIdAndCoureassessNameId1(@Param("coureassessId") Long coureassessId,@Param("coureassessNameId") Long coureassessNameId);

    @Update("update coureassess_average set " +
            "coureassess_id = #{coureassessId}, " +
            "coureassess_name_id = #{coureassessNameId}, " +
            "eva_average = #{evaAverage} " +
            "WHERE id = #{id}")
    int update(CoureassessAverage coureassessAverage);
}
